package com.cn.service.impl;

import com.cn.mapper.GoodsMapper;
import com.cn.pojo.*;
import com.cn.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:王宇航
 * @create: 2023-05-20 22:57
 * @Description:
 */
@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<Carousel> carousel() {
        return goodsMapper.carousel();
    }

    @Override
    public List<IndexGoods> NewProductLaunch(int number) {
        return goodsMapper.NewProductLaunch(number);
    }

    @Override
    public Goods searchGoodsDetail(int id) {
        return goodsMapper.searchGoodsDetail(id);
    }

    @Override
    public int addToCart(int userId, int goodsId) {
        return goodsMapper.addToCart(userId, goodsId);
    }

    @Override
    public List<ShoppingCartItem> searchCartInfo(int userId) {
        return goodsMapper.searchCartInfo(userId);
    }

    @Override
    public int deleCart(int goodsId) {
        return goodsMapper.deleCart(goodsId);
    }

    @Override
    public int updateCartNum(int num, int goodsId) {
        return goodsMapper.updateCartNum(num, goodsId);
    }

    @Override
    public List<Goods> searchGoods(String info) {
        return goodsMapper.searchGoods(info);
    }

    @Override
    public List<Category> searchCategory() {
        return goodsMapper.searchCategory();
    }

    public List<Category> searchCategory2() {
        return goodsMapper.searchCategory2();
    }

    @Override
    public List<Goods> searchGoodsByCategory(int categoryId) {
        return goodsMapper.searchGoodsByCategory(categoryId);
    }

    @Override
    public List<OrderItem> searchOrderItem(int userId) {
        return goodsMapper.searchOrderItem(userId);
    }


    @Override
    public List<Goods> findAll() {
        return goodsMapper.findAll();
    }

    @Override
    public void updateStatus(int status, int id) {
        goodsMapper.updateStatus(status, id);
    }

    @Override
    public void updateCarousel(int id) {
        goodsMapper.updateCarousel(id);
    }

    @Override
    public List<IndexGoods> findIndexConfig(int id) {
        return goodsMapper.findIndexConfig(id);
    }

    @Override
    public ShoppingCartItem findCartItem(int userId, int goodsId) {
        return goodsMapper.findCartItem(userId, goodsId);
    }

    @Override
    public void addNum(int itemId) {
        goodsMapper.addNum(itemId);
    }

    @Override
    public int addCarousel(Carousel carousel) {
        return goodsMapper.addCarousel(carousel);
    }

    @Override
    public int addGoods(Goods goods) {
        return goodsMapper.addGoods(goods);
    }

    @Override
    public int editGoods(Goods goods) {
        return goodsMapper.editGoods(goods);
    }

    @Override
    public int deleIndexConfigs(int configId) {
        return goodsMapper.deleIndexConfigs(configId);
    }

    @Override
    public IndexGoods findByConfigId(int configId) {
        return goodsMapper.findByConfigId(configId);
    }

    @Override
    public void addIndexGoods(IndexGoods indexGoods) {
        goodsMapper.addIndexGoods(indexGoods);
    }

    @Override
    public void updateIndexGoods(IndexGoods indexGoods) {
        goodsMapper.updateIndexGoods(indexGoods);
    }

    @Override
    public Category findCategory(int categoryId) {
        return goodsMapper.findCategory(categoryId);
    }

    @Override
    public void addCategory(Category category) {
        goodsMapper.addCategory(category);
    }

    @Override
    public void editCategory(Category category) {
        goodsMapper.editCategory(category);
    }

    @Override
    public void deleCategory(int categoryId) {
        goodsMapper.deleCategory(categoryId);
    }
}
